import { uploadImgToken} from '@/api/news.js'
const state = {
	  token:'',
    qiniuUrl: "http://www-web-jshtml-cn-idva7mx.web-jshtml.cn/",
	action:"http://up-z2.qiniup.com"
}
const getters = {
    qiniuUrl: state => state.qiniuUrl
}
const mutations = {}
const actions = {  // 可以回调处理事情 
	getToken({state},data){
		// 图片上传配置
		const uploadImgConfig ={
		  action: state.action,
		  accesskey: "Avh-EZZAa4TxqPQZsEW42fXBUbTMFi-RKSZTRKJj",
		  secretkey: "l9AXtnhCVkZexXNRcmHXzmecXiCUiLynwGboMeUw",
		  buckety: "webjshtml"
		};
		uploadImgToken(uploadImgConfig).then(res=>{
			state.token = res.data.token
		})
	}
}


export default {
    namespaced: true,
    mutations,
    state,
    getters,
    actions
};
